<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>BFC：margin塌陷问题</title>
  <style type="text/css">
    .box1{
      /* 可选方式 */
      /* border: 1px solid transparent; */

      /* 解决方式，形成BFC */
      /* display: inline-block; */
      /* display: table-cell; */
      /* overflow: hidden; */
      /* float: left; */
      width: 300px;
      height: 300px;
      background-color: #000;
    }

    .box2{
      width: 50px;
      height: 50px;
      margin: 0 auto;
      margin-top: 100px;
      background-color: orange;
    }
  </style>
</head>
<body>
  <div class="box1">
    <div class="box2"></div>
  </div>
</body>
</html>